package com.xiaojie.mapper;

import com.xiaojie.entity.Permission;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ClassName PermissionMapper
 * @Description TODO
 * @Author HTGY02
 * @Date 2021/4/28 10:46
 * @Version 1.0
 **/
public interface PermissionMapper {

    @Select("SELECT\n" +
            "\tsp.*\n" +
            "FROM\n" +
            "\tsys_user u\n" +
            "\tINNER JOIN sys_user_role r ON u.id = r.user_id\n" +
            "\tINNER JOIN sys_role sr ON r.role_id=sr.id\n" +
            "\tINNER JOIN sys_role_permission srp ON srp.role_id=r.role_id\n" +
            "\tINNER JOIN sys_permission sp ON sp.id=srp.perm_id WHERE u.username=#{username}")
    List<Permission> listAll(String username);
    @Select("select * from sys_permission")
    List<Permission> findAll();
}
